package club.itstudio.IContainer.util;

public class Random {
    private static final char[] charSands = new char[]{
            'w', 'e', 'r', 't', 'y', 'u', 'S', 'A', 'i',  'P', 'o', 'p', 'Z', 'a', 's', 'd', 'J',  'f', 'g', 'h', 'j',
            'k', 'l', 'z', 'x', 'N', 'c', 'v', 'b', 'D', 'n', 'm','q', '0', 'G', '1', '2', 'V', '3', '4',  'H', '5',
            '6', '7', '8', '9', 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'F', 'K', 'L',  'X', 'C',  'B', 'M'
    };

    private static final char[] intSands = new char[]{
            '1', '2', '3', '4', '5', '6', '7', '8', '9', '0'
    };



    public static String getRandom(int length, char[] sands) {
        StringBuilder sb = new StringBuilder(length);
        var random = new java.util.Random(System.nanoTime());
        for (int i = 0; i < length; i++) {
            int index = random.nextInt(sands.length);
            sb.append(sands[index]);
        }
        return sb.toString();
    }

    public static String getRandomStr(int length) {
        return getRandom(length, charSands);
    }

    public static String getRandomIntStr(int length) {
        return getRandom(length, intSands);
    }
}
